package com.oauth.twitter.server.conf;

import java.util.EnumSet;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.oauth.service.application.registry.beans.ApplicationInfoBean;
import com.oauth.service.global.ApplicationGlobalService;
import com.oauth.service.global.beans.GlobalDataType;
import com.oauth.twitter.client.ui.MainPanel;

@Component
@Qualifier("applicationInfoBean")
public class TwitterInfoBean implements ApplicationInfoBean {

	@Value("${twitter.key}")
	private Long mKey;

	@Value("${twitter.name}")
	private String mName;

	@Value("${twitter.addUrl}")
	private String mAddUrl;

	@Value("${twitter.iconImageUrl}")
	private String mIconUrl;

	@Value("${twitter.appImageUrl}")
	private String mImageUrl;

	@Value("${twitter.global.datatypes}")
	private String globalDataTypes;

	@Autowired
	@Qualifier("twitterGlobalService")
	private ApplicationGlobalService twitterGlobalService;

	@Override
	public String getAddUrl() {
		return mAddUrl;
	}

	public EnumSet<GlobalDataType> getGlobalDataType() {
		return GlobalDataType.getEnumSetByName(globalDataTypes);
	}

	public Class<?> getWidgetClass() {
		return MainPanel.class;
	}

	@Override
	public ApplicationGlobalService getAppGlobalService() {
		return twitterGlobalService;
	}

	@Override
	public String getIconUrl() {
		return mIconUrl;
	}

	@Override
	public String getImageUrl() {
		return mImageUrl;
	}

	@Override
	public Long getKey() {
		return mKey;
	}

	@Override
	public String getName() {
		return mName;
	}

}
